
public class Sync {
	public Object[] noteArray = new Object[2];
	public int lastClk = 0;
	public void run() throws InterruptedException {
		for (int i=0; i<8; i++) {
			noteOut(60,100,750);
		}
		Thread.sleep(3000,0);
		Main.timeDiff = lastClk-Main.lastInClk+500;
		System.out.println("Synchronized with difference = "+Main.timeDiff);
		
	}
	public void noteOut(int note, int vel,int wait) throws InterruptedException{
		lastClk = (int)(System.currentTimeMillis());
		noteArray[0] = note;
		noteArray[1] = vel;
		System.out.println("------generated note:" + noteArray[0] + " " + noteArray[1] + " " + wait);
		OSC.main(noteArray,"/mididata3");
		Thread.sleep(wait,0);
	}
}
